#ifndef FOUNDATION_SETTINGS_XMLCONFIG_H
#define FOUNDATION_SETTINGS_XMLCONFIG_H

#ifndef __cplusplus
extern "C" {
#endif

#include <tinyxml2.h>
#ifndef __cplusplus
}
#endif
#include <functional>
#include <map>
#include <string>
#include <utils/logger.h>

namespace settings {
class XmlConfig {
public:
    XmlConfig();
    ~XmlConfig();
    bool Load(const std::string &path);

    void GetElemValue(const std::string &father, std::function<void(std::map<std::string, std::string> &)>);

    const std::string GetElemValueString(const std::string &father, const std::string elem);
    const int32_t GetElemValueInt(const std::string &father, const std::string elem);
    const bool GetElemValueBool(const std::string &father, const std::string elem);

private:
    tinyxml2::XMLDocument xmlDocument_;
    tinyxml2::XMLElement *xmlRoot_;
};
} // namespace settings
#endif // FOUNDATION_WEBCONFIG_XMLCONFIG_H